/*
 * $Id: ActScheduledObject.java,v 1.10 2009/12/16 18:31:22 navdeep_mahajan Exp $
 *
 * Copyright (C) 2006 General Electric Company. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 *
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */

/*
 * Created Tue Jan 06 14:20:57 CST 2009 by MyEclipse Hibernate Tool.
 */
package com.ge.healthcare.autosc.common.database.pojo;

import java.io.Serializable;

import com.ge.healthcare.autosc.common.message.converter.AutoSCMessage;
import com.ge.healthcare.autosc.common.util.TimeFormatStandard;

/**
 * A class that represents a row in the 'ACT_SCHEDULED_OBJECT' table. This class
 * may be customized as it is never re-generated after being created.
 */
public class ActScheduledObject extends AbstractScheduledObject implements
		Serializable {
	/**
	 * Eclipse generated
	 */
	private static final long serialVersionUID = -2746080429565411277L;

	public static final String TABLE_NAME = "com.ge.healthcare.autosc.common.database.pojo.ActScheduledObject";

	public static final String COL_SCHEDULED_OBJECT_ID = "scheduledObjectId";
	public static final String COL_OBJECT_ID = "objectId";
	public static final String COL_OBJECT_TYPE = "objectType";

	public static final String REQUEST_OBJECT_TYPE = "R";
	public static final String TASK_OBJECT_TYPE = "T";

	public static final Object COL_SCHEDULED_DATE = "scheduled_date";

	/**
	 * Simple constructor of ActScheduledObject instances.
	 */
	public ActScheduledObject() {
	}

	/**
	 * Constructor of ActScheduledObject instances given a simple primary key.
	 * 
	 * @param schedulerRequestId
	 */
	public ActScheduledObject(java.lang.Long schedulerRequestId) {
		super(schedulerRequestId);
	}

	public ActScheduledObject(AutoSCMessage msg) {
		this.setObjectId(msg.getObjectId());
		this.setObjectType(msg.getObjectType());
	}

	/* Add customized code below */

	public boolean isTask() {
		return (this.getObjectType().equals(TASK_OBJECT_TYPE)) ? true : false;
	}

	public boolean isRequest() {
		return (this.getObjectType().equals(REQUEST_OBJECT_TYPE)) ? true
				: false;
	}

	public String toString() {
		StringBuffer msg = new StringBuffer();
		msg.append("Id: ").append(this.getScheduledObjectId());
		msg.append(",Object Id: ").append(this.getObjectId());
		msg.append(",object type: ").append(this.getObjectType());
		msg.append(",Enter Date: ").append(
				TimeFormatStandard.getDtInEndUserDisplayFormat(this
						.getEnterDate()));
		msg.append(",Scheduled Date: ").append(
				TimeFormatStandard.getDtInEndUserDisplayFormat(this
						.getScheduledDate()));
		return msg.toString();
	}
}
